package com.log4j.lookup

import org.apache.logging.log4j.core.LogEvent
import org.apache.logging.log4j.core.config.plugins.Plugin
import org.apache.logging.log4j.core.lookup.AbstractLookup
import org.apache.logging.log4j.core.lookup.StrLookup

/**
 * separator
 */
@Plugin(name = "sep", category = StrLookup.CATEGORY)
class ConditionLookup: AbstractLookup() {

    override fun lookup(event: LogEvent?, key: String?): String {
        if (key.isNullOrBlank()) {
            return ""
        }
        return "-$key"
    }

}